<template>
	<view>
    <uni-list>
      <uni-list-item title="姓名" :rightText="profile.name"/>
      <uni-list-item title="性别" :rightText="profile.gender"/>
      <uni-list-item title="生日" :rightText="profile.birthday"/>
      <uni-list-item title="手机号" :rightText="profile.mobile"/>
<!--      <uni-list-item title="焊工工号" :rightText="profile.welderNum"/>-->
<!--      <uni-list-item title="证件类型" :rightText="welderType[profile.type]"/>-->
<!--      <uni-list-item title="到期时间" :rightText="profile.endTime"/>-->
      <uni-list-item title="公司" :rightText="profile.company"/>
      <uni-list-item title="部门" :rightText="profile.department"/>
    </uni-list>
    <divider></divider>
    <view class="my-button" @click="toLogout">退出登录</view>
    <divider></divider>
    <view class="my-button" @click="toPassword">修改密码</view>
		<tab-bar ref='commentTabbat' :actives="2"></tab-bar>
    <modal v-model="showModal" confirm-style="color: #DC2115" title='询问'
           text='是否退出登录' @confirm='logout'></modal>
    <message ref="message"></message>
	</view>
</template>

<script>
	import tabBar from '../../components/tabbar.vue'
  import uniList from '@/components/uni/uni-list.vue'
  import uniListItem from '@/components/uni/uni-list-item.vue'
  import divider from "../../components/divider";

	import store from "@/store/index.js"

	export default {
		data() {
			return {
        welderType: ['普通焊工', 'PE焊工'],
				profile: {
				  name: uni.getStorageSync("username"),
          gender: uni.getStorageSync("gender") === 1 ? '男' : '女',
          birthday: '',
          mobile: '',
          // welderNum: '',
          // type: 0,
          // endTime: '2029-08-11',
          company: uni.getStorageSync("company"),
          department: uni.getStorageSync("department")
        },
        showModal: false
			}
		},

		methods: {
      /**
       * 跳转到修改密码的页面
       */
      toPassword() {
        uni.navigateTo({
          url: '/pages/my/password'
        })
      },
      /**
       * 弹出登出的提示框
       */
      toLogout() {
        this.showModal = true;
      },
      /**
       * 登出
       */
      logout() {
        store.commit('logout')
      }
		},
		components: {
			tabBar, uniList, uniListItem, divider
		},
    onReady() {
      this.$refs.message.setMessageToStore(this.$refs.message)
    }
	}
</script>

<style scoped lang="scss">
 @import "~@/static/css/my/my.scss";
</style>

<style>
  page {
    background-color: #f5f5f5;
  }
</style>
